<?php


namespace app\lunwen\controller;


use app\lunwen\model\LeaveMessageModel;
use cmf\controller\HomeBaseController;

class TeacherLeaveMessageController extends HomeBaseController
{
    public function index(){

        $file = new LeaveMessageModel();
        $file->student_name = $_POST['input1'];
        $file->student_id =  $_POST['input3'];
        $file->receive_people = $_POST['input1'];
        $file->content = $_POST['input2'];
        $file->send_people =session("teacher_name");
        $file->save();

        $file = new LeaveMessageModel();
        $data = $file->whereor("receive_people",session("teacher_name"))
            ->whereor("send_people",session("teacher_name"))
            ->whereTime('create_time','>',session('beforeYear'))
            ->whereTime('create_time','<',session('afterYear'))
            ->all();
        $this->assign('title',$data);
        return $this->fetch(':teacherShowMessage');
    }
}